<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增惩奖经历')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-hortation-add" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input name="id" type="hidden" id="id" th:value="${id}"/>
        <h4 class="form-header h4">惩奖经历</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">惩奖形式：</label>
                    <div class="col-sm-8">
                        <select name="HortationType" id="HortationType" class="form-control m-b"
                                th:with="type=${@dict.getType('eCD_HortationType')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">惩奖类别：</label>
                    <div class="col-sm-8">
                        <select name="HortationKind" id="HortationKind" class="form-control m-b"
                                th:with="type=${@dict.getType('eCD_HortationKind')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>                     </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">惩奖时间：</label>
                    <div class="col-sm-8">
                        <input name="HappenDate" id="HappenDate" class="form-control laydate-demo-1" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">实施机构：</label>
                    <div class="col-sm-8">
                        <input name="Organizer" id="Organizer" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">惩奖原因：</label>
                    <div class="col-sm-8">
                        <input name="Reason" id="Reason" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">备注：</label>
                    <div class="col-sm-8">
                        <input name="Remark" id="Remark" class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "entryManage/EntryBackground";

    $(function () {

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-hortation-add").serializeArray();

            var ID = $("#ID").val();
            var HortationType = $("#HortationType").val();
            var HortationKind = $("#HortationKind").val();
            var HappenDate = $("#HappenDate").val();
            var Organizer = $("#Organizer").val();
            var Reason = $("#Reason").val();
            var Remark = $("#Remark").val();

            data.push({"name": "ID", "value": ID});
            data.push({"name": "HortationType", "value": HortationType});
            data.push({"name": "HortationKind", "value": HortationKind});
            data.push({"name": "HappenDate", "value": HappenDate});
            data.push({"name": "Organizer", "value": Organizer});
            data.push({"name": "Reason", "value": Reason});
            data.push({"name": "Remark", "value": Remark});

            $.operate.save(prefix + "/addHortation", data);

        }
    }


</script>
</body>
</html>
